/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.singleton;

/**
 * 饿汉单例模式增强版，解决多线程问题
 * 
 * @author aeky
 */
public class Singleton4LazyEnhance {

    private volatile static Singleton4LazyEnhance instance;

    public Singleton4LazyEnhance() {

    }

    public static Singleton4LazyEnhance getInstance() {
        if (instance == null) {
            synchronized (Singleton4LazyEnhance.class) {
                if (instance == null) {
                    instance = new Singleton4LazyEnhance();
                }
            }
        }
        return instance;
    }
}
